class Dog(object):


	instance = None

	init_flag = False

	# 注意要加上name这个参数,添加name这个参数的目的是不能__new__方法报错.
	def __new__(cls,name):
		if cls.instance == None:
			cls.instance = object.__new__(cls)
			return cls.instance
		else:
			return cls.instance


	def __init__(self,name):
		if Dog.init_flag == False:
			self.name = name
			Dog.nit_flag = True




a = Dog("旺财")
print(id(a))
print(a.name)


b = Dog("哮天犬")
print(id(b))
print(b.name)